package com.lala.rennigou.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lala.rennigou.mapper.EasybuyProductMapper;
import com.lala.rennigou.pojo.EasybuyProduct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EasybuyProductServiceImpl implements EasybuyProductService{
    @Autowired
    private EasybuyProductMapper easybuyProductMapper;
    @Override
    public PageInfo<EasybuyProduct> seleceByCategoryLevel3Id(int categoryLevel3Id,int p ,int s) {
        PageHelper.startPage(p,s);
        List<EasybuyProduct> easybuyProducts = easybuyProductMapper.seleceByCategoryLevel3Id(categoryLevel3Id);
        PageInfo pageInfo=new PageInfo(easybuyProducts);
        return pageInfo;
    }

    @Override
    public EasybuyProduct selectById(int id) {
        return easybuyProductMapper.selectById(id);
    }

    @Override
    public PageInfo<EasybuyProduct> selectAll(int pagenum,int pagesize) {
        PageHelper.startPage(pagenum,pagesize);
        List<EasybuyProduct> list = easybuyProductMapper.selectAll();
        PageInfo<EasybuyProduct> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public int deletePbyid(int id) {
        return easybuyProductMapper.deleteById(id);
    }

    @Override
    public int updatePbyid(EasybuyProduct easybuyProduct) {
        return easybuyProductMapper.updateById(easybuyProduct);
    }

    @Override
    public int updataIsdelete(int id) {
        return easybuyProductMapper.updataIsdelete(id);
    }

    @Override
    public List<EasybuyProduct> selectAllP() {
        return easybuyProductMapper.selectAll();
    }

    @Override
    public int addSP(EasybuyProduct easybuyProduct) {
        return easybuyProductMapper.insert(easybuyProduct);
    }

    @Override
    public int insertSP(EasybuyProduct easybuyProduct) {
        return easybuyProductMapper.insertSP(easybuyProduct);
    }


}
